package 力扣日常刷题.木22一月.第15天0127;

import java.util.HashMap;
import java.util.Map;

/**
 * @author 帅小伙
 * @date 2022/1/27
 * @description
 */
public class Demo03中等字符串TnyURL的加密与解密 {

    Map<Integer, String> map = new HashMap<Integer, String>();
    int i = 0;

    public String encode(String longurl){
        map.put(i,longurl);
        return "http://tinyurl.com/"+i;
    }

    public String decode(String shortUrl){
        return map.get(Integer.parseInt(shortUrl.replace("http://tinyurl.com/","")));
    }


}
